package com.ftg.learn.chapter09.collection;

import java.util.List;
import java.util.Stack;
import java.util.Vector;

/**
 *
 * 栈
 * @author lijiaxin
 * @version 1.0
 * @date 2023/8/14 16:09
 */

public class VectoryStack {

    public static void main(String[] args) {
        //矢量 (动态数组)
        List<String> vc = new Vector<>(3,5);
//        10 20 40 80                        初始3，每次扩容加5   括号里不写就*2
        //3 8 13 18

        //线程安全
        Stack<String> stack = new Stack<>();
        stack.add("aa");
        stack.push("ii");
        stack.push("yy");
        stack.add("uu");

        System.out.println(stack);

        System.out.println(stack.pop());
        System.out.println(stack.pop());
        System.out.println(stack.pop());

        System.out.println(stack.pop());
    }

}

